#pragma once

#ifndef _CVANATIME_H_
#define _CVANATIME_H_

class CVanaTime 
{
protected:
	static CVanaTime * _instance;

	//Big ol' integer for the vanadiel time 
    unsigned long long m_vanaDate;

	//Vanadiel Year
	unsigned int m_vYear;

	//Vanadiel Month
	unsigned int m_vMon;

	//Vanadiel Date (day of the month)
	unsigned int m_vDate;

	//Vanadiel Hour
	unsigned int m_vHour;

	//Vanadiel Minute
	unsigned int m_vMin;

	//Vanadiel Day (Day of the week, fire,earth,wind)
	unsigned int m_vDay;

	//Custom offset
	unsigned int m_customOffset;
public:
	CVanaTime();
	static CVanaTime * getInstance();

	static const unsigned int baseDate		= 1024844400;	//Real starting date for Vana time
	static const unsigned int msGameYear	= 518400;		// 360 * msGameDay
	static const unsigned int msGameMonth	= 43200;		// 30 * msGameDay
	static const unsigned int msGameWeek	= 11520;		// 8 * msGameDay
	static const unsigned int msGameDay		= 1440;			// 24 hours * msGameHour
	static const unsigned int msGameHour	= 60;			// 60 minutes

	unsigned int getYear(void);
	unsigned int getMonth(void);
	unsigned int getDayOfTheMonth(void);
	unsigned int getHour(void);
	unsigned int getMinute(void);
	unsigned int getWeekday(void);
	void getTime(unsigned long long* vanaDate, unsigned int* year, unsigned int* month, unsigned int* dayOfTheMonth, unsigned int* hour, unsigned int* minute, unsigned int* weekday);
	unsigned long long getDate(void);

	//Sync the vanadiel time with real time
	void SyncTime(void);

	//Is it time for undeads?
	bool isUndeadTime();

	//Is it time for bats?
	bool isBatTime();

	//Is it time to update the shops ?
	bool isShopUpdateTime(); 

	//Modify the custom offset for vana time
	void setCustomOffset(unsigned int newOffset);
};
#endif